package com.woniuxy.controller;

import com.woniuxy.entitys.TbPermission;
import com.woniuxy.services.PermissionService;
import com.woniuxy.utils.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class PerController {
    @Autowired
    private PermissionService permissionService;
    @GetMapping("/company/menus")
    public ResultVO getMenuTree(HttpServletRequest httpServletRequest){
        String token = httpServletRequest.getHeader("token");
        List<TbPermission> perMenuTree = permissionService.getPerMenuTree(token);
        return perMenuTree!=null?ResultVO.success("菜单查询成功",perMenuTree):ResultVO.failure("菜单查询失败");
    }
}
